<!DOCTYPE html>
<html lang="en">
    <include file="Public/head" />
    <style type="text/css">
        #video{
            display: none;
            z-index:999;
            position:absolute;
            margin-left: 300px;
        }
    </style>
<body data-type="widgets">
    <script src="__PUBLIC__/assets/js/theme.js"></script>
    <div class="am-g tpl-g">
        <!-- 头部 -->
    <include file="Public/header" />
        <!-- 风格切换 -->
        <div class="tpl-skiner">
            <div class="tpl-skiner-toggle am-icon-cog">
            </div>
            <div class="tpl-skiner-content">
                <div class="tpl-skiner-content-title">
                    选择主题
                </div>
                <div class="tpl-skiner-content-bar">
                    <span class="skiner-color skiner-white" data-color="theme-white"></span>
                    <span class="skiner-color skiner-black" data-color="theme-black"></span>
                </div>
            </div>
        </div>
        
<include file="Public/left" />
        <!-- 内容区域 -->
        <div class="tpl-content-wrapper">

            <div class="row-content am-cf">
                <div class="row">

                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                        <div class="widget am-cf">
                            <div class="widget-head am-cf">
                                <div class="widget-title am-fl"><h1 style="display:inline">管理视频</h1></div>
                            </div>
                            <div class="widget-body  widget-body-lg am-fr">

                                    <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black ">
                                        <thead>
                                            <tr>
                                                <th>序号</th>
                                                <th>视频名称</th>
                                                <th>发布人</th>
                                                <th>发布时间</th>
                                                <th>操作</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <volist name="video" id="vo">
                                            <tr class="gradeX">
                                            <div id="video">
                                                <video src="" autoplay="autoplay" controls="controls" onclick="none()" id="play"
                                                width="800" height="600"></video>
                                            </div>
                                                <td class="am-text-middle">{$i}</td>
                                                <td class="am-text-middle"><a href="javascript:video({$vo.videoid})">{$vo.videoname}</a></td>
                                                <td class="am-text-middle">{$vo.coachname}</td>
                                                <td class="am-text-middle">{$vo.time}</td>
                                                <td class="am-text-middle">
                                                    <div class="tpl-table-black-operation">
                                                        <a href="{:U('Home/video/delete',array('videoid'=>$vo['videoid']))}" class="tpl-table-black-operation-del">
                                                            <i class="am-icon-trash"></i> 删除
                                                        </a>
                                                    </div>
                                                </td>
                                            </tr>
                                            </volist>
                                        </tbody>
                                    </table>

                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>
    </div>

    <include file="Public/bottom" />
</body>
<script type="text/javascript">
function getxmlrequest(){
  if(XMLHttpRequest == "undefined"){
    XMLHttpRequest = function(){
      try{return new ActiveXObject("Msxml2.XMLHTTP.6.0");}
      catch(e){}
      try{return new ActiveXObject("Msxml2.XMLHTTP.3.0");}
      catch(e){}
      try{return new ActiveXObject("Msxml2.XMLHTTP");}
      catch(e){}
      try{return new ActiveXObject("Microsoft.XMLHTTP");}
      catch(e){}
      return false;
    }
  }
  return new XMLHttpRequest();
}

function video(id){
  var request = getxmlrequest();
  if(request){
    request.open("GET","videoname?id="+id,true);
    request.onreadystatechange = function(){
      if(request.readyState == 4){
        var name = request.responseText;  
        // var obj = document.getElementById("my-popups");
        // var inputObj = obj.getElementsByTagName("input");
        // var textArea = obj.getElementsByTagName("textarea"); 
        var json = JSON.parse(name);
        var abc = json.video;
        document.getElementById("video").style.display="inline";
        document.getElementById("play").src="__PUBLIC__/photo/"+abc;
        document.getElementById("play").play();
      }
    };
    request.send(null);   
  }else{
    alert("不支持ajax");
  }
}

    function none(){
        document.getElementById("video").style.display="none";
        document.getElementById("play").src="";
    }
</script>

</html>  